	//切换排序按钮样式
	$(".wall_nav_box a").on("click",function(){
	    $(this).addClass("active").siblings().removeClass("active");
	});  
	/*筛选*/
	$(".weui_navbar_item").click(function(){
		$(".screen").show();
	});
	$(".cancelBtn").click(function(){
		$(".screen").hide();
	});
	$(".screen-div>.filterProperty>div>ul>li").click(function(){
		$(this).find("a").addClass("active");
	})
	
	//初始化时加载产品
	window.onload = function(){
		loadProduct();
	}
	
	//产品列表页面游标
	var offset = 0;
	
	//获取产品列表
	function loadProduct(){
		$.ajax({
			url:"/api/product/list",
			dataType:"json",
			data:{
				"sortStr":"unit_price",
				"sortType":"desc",
				"offset":offset,
				"item":10
			},
			type:"post",
			success:function(data){
				addProductDom(data);
			},
			error:function(data){
				console.log(JSON.stringify(data));
			}
		});
	}
	
	//生成产品列表dom
	function addProductDom(data){
		for(var product in data){
			product = data[product];
			//产品外层div
			var content = $('<div class="oneProduct"></div>');
			//产品链接a标签
			var aTag = $('<a class="productA"></a>');
			//左上角标签
			if(false){
				var leftTag = $('<div><span></span></div>');
				content.append(leftTag);
			}
			//产品图片
			var backImage = $('<div class="backImage"><img src="'+urlToThumbnail(product.cover1)+'" /></div>');
			//产品信息
			var productInfo = $('<div class="product-msg">'+
				'<div class="product-name ellipsis-product-name">'+product.productAliasName+'</div>'+
					'<div class="product-value clearfix">'+
					'<div class="fl">¥'+product.unitPrice+'</div>'+
					'<div class="toCartBtn fr"><button><i class="icon iconfont icon-gouwuche" style="font-size: .6rem;"></i></button></div>'+
				'</div></div>');
			//添加到文档流	
			aTag.append(backImage);aTag.append(productInfo);
			content.append(aTag);
			$(".twoProduct").append(content);
		}
	}
	
	//滑动刷新
	var noDate=false;
	$(function(){
		var wiwH=$(window).height();
		$(document).scroll(function(){
			console.log("滑动");
		    $('.content').dropload({
	            scrollArea : window,
	            domUp : {
	                domClass   : 'dropload-up',
	                domRefresh : '<div class="dropload-refresh"><i class="iconfont">&#xe634;</i>下拉刷新</div>',
	                domUpdate  : '<div class="dropload-update"><i class="iconfont">&#xe633;</i>释放更新</div>',
	                domLoad    : '<div class="dropload-load"><span class="iconfont">&#xe62c;</span>加载中...</div>',
	                domNoData  : '<div class="dropload-noData">已经到顶部了</div>'
	            },
	            domDown : {
	                domClass   : 'dropload-down',
	                domRefresh : '<div class="dropload-refresh"><i class="iconfont">&#xe633;</i>上拉加载更多</div>',
	                domLoad    : '<div class="dropload-load"><span class="iconfont">&#xe62c;</span>加载中...</div>',
	                domNoData  : '<div class="dropload-noData">暂无数据</div>'
	            },
	            loadDownFn : function(me){
	            	offset = offset + 1;
	            	loadProductDown(offset,me);
	            },
	            threshold : 50
	        });
		});
	});
	
	//下拉刷新方法
	function loadProductDown(offset,me){
		me.resetload(true);
	    me.unlock('up');
		console.log("loadProductDown");
	}
	//加载成功
	
	//图片路径转换为缩略图路径
	function urlToThumbnail(url){
		var foucs = url.lastIndexOf("/");
		if(url.indexOf("thumbnailImage/") == -1){
			url = url.substring(0,foucs)+"/thumbnailImage"+url.substring(foucs,url.length)
		}
		return url;
	}